home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ListPart.h
-
- Contains: Sample part editor class implementation
-
- Written by: Steve Smith
-
- Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
- */
-
- #ifndef _LISTPART_
- #define _LISTPART_
-
- // -- Compiler/Preprocessor Switches --
-
- #ifndef _COMPILERDEFS_
- #include "CompDefs.h"
- #endif
-
- // -- OpenDoc Includes --
-
- #ifndef _ODTYPES_
- #include <ODTypes.h>
- #endif
-
- // -- Macintosh Includes --
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __QDOFFSCREEN__
- #include <QDOffScreen.h>
- #endif
-
- #ifndef SOM_ACF_DevServ_som_ListPart_xh
- #include "som_ListPart.xh"
- #endif
-
- // -- Forward Declarations --
-
- class Environment;
- class ODFacet;
- class ODFocusSet;
- class ODFrame;
- class ODMenuBar;
- class ODShape;
- class ODStorageUnit;
- class ODWindow;
- class CList;
-
- struct WindowProperties;
-
- extern Environment* gEv;
- extern ODFacet* gFacet;
- extern ControlHandle gControl;
- extern ODPart* gMySelf;
- extern short gInitDelta, gTempoVal;
- extern char gTextVersion[71];
-
- #define mabs(val) (((val)>0)?(val):(-(val)))
-
- #define kNull 1
- #define kPassive 2
- #define kActive 3
- #define kMultiple 4
-
- #define kMargin 6
-
- #define kODPropListListIndex "List:Property:ListIndex"
- #define kODPropListNbLines "List:Property:NbLines"
- #define kODPropListLineHeight "List:Property:LineHeight"
- #define kODPropListLineWidth "List:Property:LineWidth"
- #define kODPropListLineDepth "List:Property:LineDepth"
- #define kODPropListAutoThumb "List:Property:AutoThumb"
- #define kODPropListWantKey "List:Property:WantKey"
- #define kODPropListKind "List:Property:Kind"
- #define kODPropListSel "List:Property:Sel"
- #define kODPropListMul "List:Property:Mul"
-
- #define kListShort "List:Kind:Short"
- #define kListChars "List:Kind:Chars"
-
- typedef struct
- {
- ControlHandle fListCtl;
- short fNbVis;
- Rect fUsedRect;
- } ListFacetInfo, *ListFacetInfoPtr;
-
- #pragma import on
-
- class ListPart {
-
- //==================================
- // Overridden Public ODPart Methods
- //==================================
- public:
-
- ListPart();
- virtual ~ListPart();
-
- // -- Initialization --
-
- void InitPart(Environment* ev, ODStorageUnit* storageUnit,
- ODPart* partWrapper, ACF_DevServ_som_ListPart* somSelf);
- void InitPartFromStorage(Environment* ev, ODStorageUnit* storageUnit,
- ODPart* partWrapper, ACF_DevServ_som_ListPart* somSelf);
-
- // -- Storage --
-
- void Release(Environment* ev);
- void ReleaseAll(Environment* ev);
- ODSize Purge(Environment* ev, ODSize size);
- void Externalize(Environment* ev);
- void ExternalizeKinds(Environment* ev, ODTypeList* kindset);
- void ChangeKind(Environment* ev, ODType kind);
- void CloneInto(Environment* ev, ODDraftKey key,
- ODStorageUnit* destinationSU,
- ODFrame* initiatingFrame);
- void WritePartInfo(Environment* ev, ODInfoType partInfo,
- ODStorageUnitView* storageUnitView);
- ODInfoType ReadPartInfo(Environment* ev, ODFrame* frame,
- ODStorageUnitView* storageUnitView);
- void ClonePartInfo(Environment *ev, ODDraftKey key, ODInfoType partInfo,
- ODStorageUnitView* storageUnitView,
- ODFrame* scopeFrame);
-
- // -- Layout --
-
- void DisplayFrameAdded(Environment* ev, ODFrame* frame);
- void DisplayFrameRemoved(Environment* ev, ODFrame* frame);
- void DisplayFrameClosed(Environment* ev, ODFrame* frame);
- void DisplayFrameConnected(Environment* ev, ODFrame* frame);
- void AttachSourceFrame(Environment* ev, ODFrame* frame,
- ODFrame* sourceFrame);
- void ViewTypeChanged(Environment* ev, ODFrame* frame);
- void FrameShapeChanged(Environment* ev, ODFrame* frame);
- ODID Open(Environment* ev, ODFrame* frame);
-
- // -- Imaging --
-
- void Draw(Environment* ev, ODFacet* facet, ODShape* invalidShape);
- void GeometryChanged(Environment* ev, ODFacet* facet,
- ODBoolean clipShapeChanged,
- ODBoolean externalTransformChanged);
- void HighlightChanged(Environment* ev, ODFacet* facet);
- void FacetAdded(Environment* ev, ODFacet* facet);
- void FacetRemoved(Environment* ev, ODFacet* facet);
-
- // -- Activation --
-
- ODBoolean BeginRelinquishFocus(Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame,
- ODFrame* proposedFrame);
- void CommitRelinquishFocus(Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame,
- ODFrame* proposedFrame);
- void AbortRelinquishFocus(Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame,
- ODFrame* proposedFrame);
- void FocusAcquired(Environment* ev,ODTypeToken focus,
- ODFrame* ownerFrame);
- void FocusLost(Environment* ev,ODTypeToken focus,
- ODFrame* ownerFrame);
-
- // -- Event Handling --
-
- ODBoolean HandleEvent(Environment* ev, ODEventData* event,
- ODFrame* frame, ODFacet* facet,
- ODEventInfo* eventInfo);
- void AdjustMenus(Environment* ev, ODFrame* frame);
-
-
- //===================================
- // Newly Introduced Internal Methods
- //===================================
- protected:
-
- // -- Initialization --
-
- void Initialize(Environment* ev, ACF_DevServ_som_ListPart* somSelf);
-
- // -- Storage --
-
- void CheckAndAddProperties(Environment* ev,
- ODStorageUnit* storageUnit);
- void CleanseContentProperty(Environment* ev,
- ODStorageUnit* storageUnit);
- void InternalizeStateInfo(Environment* ev,
- ODStorageUnit* storageUnit);
- void InternalizeContent(Environment* ev,
- ODStorageUnit* storageUnit);
- void ExternalizeStateInfo(Environment* ev,
- ODStorageUnit* storageUnit,
- ODDraftKey key, ODFrame* scopeFrame);
- void ExternalizeContent(Environment* ev, ODStorageUnit* storageUnit,
- ODDraftKey key, ODFrame* scopeFrame);
- void SetDirty(Environment* ev);
-
- // -- Event Handling --
-
- ODBoolean HandleMenuEvent(Environment* ev, ODEventData* event,
- ODFrame* frame);
- ODBoolean HandleMouseEvent(Environment* ev, ODEventData* event,
- ODFacet* facet, ODEventInfo* eventInfo);
- void DoMouseEvent(Environment* ev, ODEventData* event, ODFacet* facet, Point* where);
- void DoDialogBox(Environment* ev, ODFrame* frame,
- ODSShort dialogID, ODUShort errorNumber = 0);
-
- // -- Imaging --
-
- void DrawFrameView(Environment* ev, ODFacet* facet);
- void DrawIconView(Environment* ev, ODFacet* facet);
- void DrawThumbnailView(Environment* ev, ODFacet* facet);
- void GenerateThumbnail( Environment* ev, ODFrame* frame );
-
- // -- Activation --
-
- void PartActivated(Environment* ev, ODFrame* frame);
- ODBoolean ActivateFrame(Environment* ev, ODFrame* frame, ODFacet* facet);
- void WindowActivating(Environment* ev, ODFrame* frame,
- ODBoolean activating, ODFacet* facet);
- void RelinquishAllFoci(Environment* ev, ODFrame* frame);
-
- // -- Layout --
-
- ODWindow* AcquireFramesWindow(Environment* ev, ODFrame* frame);
- ODWindow* CreateWindow(Environment* ev, ODFrame* frame, ODType frameType,
- WindowProperties* windowProperties);
- void CleanupWindow(Environment* ev, ODFrame* frame);
- WindowProperties* GetDefaultWindowProperties(Environment* ev, ODFrame* frame,
- Rect* windowRect);
- WindowProperties* GetSavedWindowProperties(Environment* ev, ODFrame* frame);
- Rect CalcPartWindowSize(Environment* ev, ODFrame* sourceFrame);
- Rect CalcPartWindowPosition(Environment* ev, ODFrame* frame,
- Rect* partWindowBounds);
- ODFacet* GetActiveFacetForFrame(Environment* ev, ODFrame* frame);
- ODShape* CalcNewUsedShape(Environment* ev, ODFrame* frame);
- void UpdateFrame(Environment* ev, ODFrame* frame, ODTypeToken view,
- ODShape* usedShape);
- void CleanupDisplayFrame(Environment* ev, ODFrame* frame,
- ODBoolean frameRemoved);
-
- // ES 11/13/95
- // • Mine… •
- public:
-
- void HandleMouseDownInList(Environment* ev, ODEventData* event, ODFacet* facet, Point macPoint);
- void TheControlAction(Environment* ev, ODFacet* theFacet, ControlHandle theControl, short thePart);
- void TheControlThumbAction(Environment* ev, ODFacet* theFacet, ControlHandle theControl);
- void DrawMultCell(Environment* ev, ODFacet* facet, short firstLine, short lastLine);
- void DrawCell(Environment* ev, ODFacet* facet, short theLine);
- void CopyFromGWorld(Environment* ev, ODFacet* facet);
- void ScrollTo(Environment* ev, ODFacet* facet, short whereto);
- void CloseCellOpened(Environment* ev);
- void NewSel(Environment* ev, ODFacet* facet, short whereto, short wherefrom, char tosel);
- short FirstClick(Environment* ev, ODFacet* facet, ODEventData* event, short* where, char* val, Point macPoint);
- void StillClick(Environment* ev, ODFacet* facet, short where, char val);
- short ClickWithMod(Environment* ev, ODFacet* facet, ODEventData* event);
- short KeyInList(Environment* ev, char theChar);
- void ExternalizeListParams(Environment* ev, ODStorageUnit* storageUnit);
- void InternalizeListParams(Environment* ev, ODStorageUnit* storageUnit);
- void SetUpListParams(Environment* ev, ODStorageUnit* storageUnit);
-
- // to call
- void ShowMe(Environment* ev, ODFacet* facet, short theLine);
- short GetNbLines(Environment* ev);
- void SetNbLines(Environment* ev, short newNbLines);
- void SetSel(Environment* ev, ODFacet* facet, short theLine);
- short GetSel(Environment* ev);
-
- // to override
- ODISOStr GetTheRealPartKind(Environment* ev);
- ODSLong OverrideBeginUsingLibraryResources(Environment* ev);
- void OverrideEndUsingLibraryResources(Environment* ev, ODSLong ref);
-
- void SetUpGraphics(Environment* ev, GWorldPtr theGWorld);
- void FillCell(Environment* ev, short theLine, Rect* theRect);
- void FillHilCell(Environment* ev, short theLine, Rect* theRect);
- void ClickInActive(Environment* ev, ODFacet* facet, ODEventData* event, Rect* theRect);
- void CloseOpenedCell(Environment* ev, ODFacet* facet);
- void IdleOpened(Environment* ev, ODFacet* facet);
- short KeyInActive(Environment* ev, ODFacet* facet, ODEventData* event);
- short KeyShortCut(Environment* ev, char theChar);
- void GotDoubleClick(Environment* ev, ODFacet* facet, short theLine);
- void ExternalizeListData(Environment* ev, ODStorageUnit* storageUnit);
- void InternalizeListData(Environment* ev, ODStorageUnit* storageUnit);
- void SetUpListData(Environment* ev, ODStorageUnit* storageUnit);
- void InitializeListData(Environment* ev,
- short* pNbLines,
- short* pLineHeight,
- short* pLineWidth,
- short* pLineDepth,
- short* pKind,
- short* pAutoThumb,
- short* pWantKey,
- short* pListIndex,
- short* pSel,
- char** pMul);
-
- protected:
-
- void AdjustFacets(Environment* ev, ODFrame* frame);
- void MyAdjustRectFacet(Environment* ev, Rect* theRect);
- void MyAdjustCtlFacet(Environment* ev, ODFacet* facet);
- void MyAdjustGWFacet(Environment* ev, ODFacet* facet);
-
- //========================
- private:
-
- CList* fDisplayFrames;
- ODBoolean fDirty;
- ODPart* fSelf;
- ODBoolean fReadOnlyStorage;
-
- // ES 11/15/95
- // • Mine… •
- ACF_DevServ_som_ListPart* fsomSelf;
- Handle fThumbnail;
- ODFacet* fOpenedFacet;
- ODFacet* fFocusedFacet;
- short fListIndex;
- short fNbLines;
- short fLineHeight;
- short fLineWidth;
- short fLineDepth;
- short fAutoThumb;
- short fKind;
- short fLineOpened;
- short fSel;
- char* fMul;
- short fWantKey;
- GWorldPtr fGWorld;
- short fGWNbLines;
- long fLastClickTime;
- short fLastClickedLine;
- short fDoubleClickedLine;
- };
-
- #pragma import off
-
- #endif